package netty.myDecoder;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;

/**
 * @Description TODO
 * @Author 李龙平
 * @Date 2020/10/13 17:35
 */
public class MyClient {
    public static void main(String[] args) throws InterruptedException {
        EventLoopGroup executors = new NioEventLoopGroup();

        try {
            Bootstrap bootstrap = new Bootstrap();
            bootstrap.group(executors).channel(NioSocketChannel.class)
                    .handler(new MyClientInitor());//自定义初始化

            ChannelFuture channelFuture = bootstrap.connect("127.0.0.1", 6668).sync();
            channelFuture.channel().closeFuture().sync();
        }finally {
            executors.shutdownGracefully();
        }
    }
}
